package com.whmskj.xjlhsc.entity;

import lombok.Data;

/**
 * @Author: Sakura
 * @Date: 2025/8/13 14:11
 * @Version: v1.0.0
 * @Description: TODO
 **/
// 设备状态统计实体
@Data
public class DeviceStatusStats {
    private int normalCount;      // 正常运行设备数量
    private int abnormalCount;    // 异常设备数量
    private double normalRatio;   // 正常运行占比
    private double abnormalRatio; // 异常运行占比

    public DeviceStatusStats(int normal, int abnormal) {
        this.normalCount = normal;
        this.abnormalCount = abnormal;
        int total = normal + abnormal;
        this.normalRatio = total > 0 ? (double) normal / total * 100 : 0;
        this.abnormalRatio = total > 0 ? (double) abnormal / total * 100 : 0;
    }
}